//
//  VisitorView.swift
//  swiftWeibo
//
//  Created by 马雪山 on 2017/7/31.
//  Copyright © 2017年 xueshanma. All rights reserved.
//

import UIKit

/// 访客视图
class VisitorView: UIView {

    override init(frame: CGRect) {
        super.init(frame: frame)
        
        
        setupUI()
        
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    func setupUI()  {
        backgroundColor = UIColor.white;
        //1.添加控件
        addSubview(iconView)
//        addSubview(tipLabel)
//        addSubview(loginBtn)
        addSubview(registerBtn)
//        //2.取消autoresizing
//        for v in subviews {
//            v.translatesAutoresizingMaskIntoConstraints = false
//        }
//        //3.自动布局
//        addConstraint(NSLayoutConstraint(item: iconView, attribute: .centerX, relatedBy: .equal, toItem: self, attribute: .centerX, multiplier: 1.0, constant: 0 ));
//        addConstraint(NSLayoutConstraint(item: iconView, attribute: .centerY, relatedBy: .equal, toItem: self, attribute: .centerY, multiplier: 1.0, constant: -60 ));

        
    }
    //MARK: 私有控件(懒加载)
    //图像
    private lazy var iconView:UIImageView = {
        var imgV = UIImageView(image: UIImage.init(named: "login_QQ_icon"));
        imgV.frame = CGRect(x: 100, y: 200, width: 100, height: 100);
        imgV.backgroundColor = UIColor.lightGray
        return imgV;
    }()
    
    //提示标签
//    private lazy var tipLabel = UILabel(frame: CGRect(x: 0, y: 0, width: 0, height: 0));
    
    //登录按钮
//    private lazy var loginBtn = UIButton(type: UIButtonType.custom)
    
    //注册按钮
    private lazy var registerBtn: UIButton = { 
        var btn = UIButton.init(frame: CGRect(x: 100, y:300 , width: 100, height: 60));
        btn.backgroundColor = UIColor.orange
        btn.setTitle("注册", for: .normal)
        btn.setBackgroundImage(UIImage.init(named: "login_register_button"), for: .normal)
        return btn
    }()

}

//MARK: 设置界面
extension VisitorView{
    
    
  
    
}








